<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>LCV Framework: cam-linux32.c Quellcode</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Erzeugt von Doxygen 1.5.3 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Hauptseite</span></a></li>
    <li><a href="classes.html"><span>Datenstrukturen</span></a></li>
    <li class="current"><a href="files.html"><span>Dateien</span></a></li>
  </ul>
</div>
<h1>cam-linux32.c</h1><a href="cam-linux32_8c.html">gehe zur Dokumentation dieser Datei</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00010"></a>00010 <span class="preprocessor">#include &lt;sys/ioctl.h&gt;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &lt;fcntl.h&gt;</span>
<a name="l00014"></a>00014 <span class="preprocessor">#include &lt;linux/ioctl.h&gt;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;errno.h&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;unistd.h&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;getopt.h&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;strings.h&gt;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#include "<a class="code" href="lcv-config_8h.html" title="Enthält die allgemeinen Definitionen des LCV Frameworks.">lcv-config.h</a>"</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include "<a class="code" href="cam_8h.html" title="Die Schnittstelle zur Kamera.">cam.h</a>"</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="cam-reg-config_8h.html" title="Enthält die Konfiguration der Kamera-Register.">cam-reg-config.h</a>"</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include "<a class="code" href="log_8h.html" title="Ein Werkzeug zur Protokollierung.">log.h</a>"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="bmp_8h.html" title="Funktionen zum Schreiben und Lesen einer BMP Datei.">bmp.h</a>"</span>
<a name="l00026"></a>00026 
<a name="l00027"></a>00027 
<a name="l00031"></a>00031 <span class="keywordtype">void</span> <a class="code" href="cam-linux32_8c.html#b53dce123c908d50845fcdc89556eff9" title="Kamera Register initialisieren.">lcv_cam_reg_init</a>();
<a name="l00032"></a>00032 
<a name="l00036"></a><a class="code" href="cam-linux32_8c.html#8049d634362b9eb19890caed04aeb40b">00036</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> <a class="code" href="cam-linux32_8c.html#8049d634362b9eb19890caed04aeb40b" title="Kamera Register inizialisiert.">cam_reg_initialized</a> = <a class="code" href="lcv-config_8h.html#a93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00037"></a>00037 
<a name="l00041"></a><a class="code" href="cam-linux32_8c.html#4fe1d355ae193dd2b61e97fcea0f32d4">00041</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="cam-linux32_8c.html#4fe1d355ae193dd2b61e97fcea0f32d4" title="Array mit Kameraregistern.">cam_reg_values</a>[<span class="keyword">sizeof</span>(<a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>) / <span class="keyword">sizeof</span>(*<a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>)];
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="cam_8h.html#abd5b4037cc6f83069eaf5718d5ed872">00043</a> <a class="code" href="structlcv__picture.html" title="Bilderstruktur für unsigned 8-bit Bilder.">lcv_picture</a> <a class="code" href="cam-linux32_8c.html#abd5b4037cc6f83069eaf5718d5ed872" title="Holt ein Bild von der Kamera.">lcv_capture_frame</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* filename)
<a name="l00044"></a>00044 {
<a name="l00045"></a>00045         <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> value;
<a name="l00046"></a>00046         <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> width, height;
<a name="l00047"></a>00047         <a class="code" href="structlcv__picture.html" title="Bilderstruktur für unsigned 8-bit Bilder.">lcv_picture</a> res_pic = <a class="code" href="bmp_8c.html#db9d72348ad074e3aa31306fd9c0f410" title="Liest ein Bitmap vom Dateisystem ein und wandelt es in ein lcv_picture um.">lcv_read_bmp</a>(filename);
<a name="l00048"></a>00048         <span class="keywordtype">char</span> * error_msg;
<a name="l00049"></a>00049         
<a name="l00050"></a>00050         width  = <a class="code" href="cam-linux32_8c.html#87fa1748b8561b93887e94d6a1e46dfa" title="Liest den Wert einer Registerkonfiguration.">lcv_config_read</a>(<a class="code" href="cam-config_8h.html#0e03dbfdd5f8c2ea81d0ee40c7c3e1fb">REG_WINDOW_WIDTH</a>);
<a name="l00051"></a>00051         height = <a class="code" href="cam-linux32_8c.html#87fa1748b8561b93887e94d6a1e46dfa" title="Liest den Wert einer Registerkonfiguration.">lcv_config_read</a>(<a class="code" href="cam-config_8h.html#46a42d02832af075fb639880da5e53ee">REG_WINDOW_HEIGHT</a>);
<a name="l00052"></a>00052         
<a name="l00053"></a>00053         <span class="comment">/*</span>
<a name="l00054"></a>00054 <span class="comment">        printf("width: %u\n", width);</span>
<a name="l00055"></a>00055 <span class="comment">        printf("col_start: %u\n", lcv_config_read(REG_COLUMN_START));</span>
<a name="l00056"></a>00056 <span class="comment">        printf("width default: %u\n", cam_reg_config[REG_WINDOW_WIDTH].default_val);</span>
<a name="l00057"></a>00057 <span class="comment">        printf("width max: %u\n", cam_reg_config[REG_WINDOW_WIDTH].max_val);</span>
<a name="l00058"></a>00058 <span class="comment">        */</span>
<a name="l00059"></a>00059                 
<a name="l00060"></a>00060         <span class="keywordflow">if</span> (width &gt; <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#0e03dbfdd5f8c2ea81d0ee40c7c3e1fb">REG_WINDOW_WIDTH</a>].max_val) {
<a name="l00061"></a>00061                 error_msg = <span class="stringliteral">"The captured picture extends the maximal possible window width"</span>;   
<a name="l00062"></a>00062                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00063"></a>00063                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00064"></a>00064                 exit(-1);
<a name="l00065"></a>00065         }
<a name="l00066"></a>00066         
<a name="l00067"></a>00067         <span class="keywordflow">if</span> (height &gt; <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#46a42d02832af075fb639880da5e53ee">REG_WINDOW_HEIGHT</a>].max_val) {
<a name="l00068"></a>00068                 error_msg = <span class="stringliteral">"The captured picture extends the maximal possible window height"</span>;  
<a name="l00069"></a>00069                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00070"></a>00070                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00071"></a>00071                 exit(-1);
<a name="l00072"></a>00072         }
<a name="l00073"></a>00073         
<a name="l00074"></a>00074         value = <a class="code" href="cam-linux32_8c.html#87fa1748b8561b93887e94d6a1e46dfa" title="Liest den Wert einer Registerkonfiguration.">lcv_config_read</a>(<a class="code" href="cam-config_8h.html#46a42d02832af075fb639880da5e53ee">REG_WINDOW_HEIGHT</a>);
<a name="l00075"></a>00075         <span class="keywordflow">if</span> (value != res_pic.<a class="code" href="structlcv__picture.html#d1fedb162e9fe3b19a1a70c24009a468">height</a>) {
<a name="l00076"></a>00076                 error_msg = <span class="stringliteral">"The captured picture does not have the same height as it is defined in the cam-register"</span>;
<a name="l00077"></a>00077                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00078"></a>00078                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00079"></a>00079                 exit(-1);
<a name="l00080"></a>00080         }       
<a name="l00081"></a>00081         
<a name="l00082"></a>00082         value = <a class="code" href="cam-linux32_8c.html#87fa1748b8561b93887e94d6a1e46dfa" title="Liest den Wert einer Registerkonfiguration.">lcv_config_read</a>(<a class="code" href="cam-config_8h.html#0e03dbfdd5f8c2ea81d0ee40c7c3e1fb">REG_WINDOW_WIDTH</a>);
<a name="l00083"></a>00083         <span class="keywordflow">if</span> (value != res_pic.<a class="code" href="structlcv__picture.html#e83ac2254761aa2c6678f140565ddf52">width</a>) {
<a name="l00084"></a>00084                 error_msg = <span class="stringliteral">"The captured picture does not have the same width as it is defined in the cam-register"</span>;
<a name="l00085"></a>00085                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00086"></a>00086                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00087"></a>00087                 exit(-1);
<a name="l00088"></a>00088         }
<a name="l00089"></a>00089         
<a name="l00090"></a>00090         <span class="keywordflow">return</span> res_pic;
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092 
<a name="l00093"></a><a class="code" href="cam_8h.html#fccc314a597adadce86329989470f8ba">00093</a> <a class="code" href="structlcv__picture.html" title="Bilderstruktur für unsigned 8-bit Bilder.">lcv_picture</a> <a class="code" href="cam-linux32_8c.html#fccc314a597adadce86329989470f8ba" title="Holt ein Bildausschnutt von der Kamera.">lcv_capture_region</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> start_x, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> start_y, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> width, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> height, <span class="keyword">const</span> <span class="keywordtype">char</span> * filename)
<a name="l00094"></a>00094 {
<a name="l00095"></a>00095         <span class="keywordtype">char</span> * error_msg;
<a name="l00096"></a>00096         <a class="code" href="structlcv__picture.html" title="Bilderstruktur für unsigned 8-bit Bilder.">lcv_picture</a> res_pic = <a class="code" href="bmp_8c.html#db9d72348ad074e3aa31306fd9c0f410" title="Liest ein Bitmap vom Dateisystem ein und wandelt es in ein lcv_picture um.">lcv_read_bmp</a>(filename);
<a name="l00097"></a>00097         <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> nWidth, nHeight, nStart_x, nStart_y;
<a name="l00098"></a>00098         
<a name="l00099"></a>00099         <span class="comment">/* Function is not yet fully implemented */</span>
<a name="l00100"></a>00100         error_msg = <span class="stringliteral">"Function not implemented"</span>;
<a name="l00101"></a>00101         printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00102"></a>00102         <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00103"></a>00103         exit(-1);
<a name="l00104"></a>00104         
<a name="l00105"></a>00105         
<a name="l00106"></a>00106         nWidth   = width;
<a name="l00107"></a>00107         nHeight  = height;
<a name="l00108"></a>00108         nStart_x = start_x;
<a name="l00109"></a>00109         nStart_y = start_y;
<a name="l00110"></a>00110         
<a name="l00111"></a>00111         <span class="comment">/* Auf legale Werte prüfen , Korrektur auf maximal mögliche Fenstergrösse */</span>
<a name="l00112"></a>00112         <span class="keywordflow">if</span> (nStart_x &lt; <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#68f230679792e1a9d62495b02b261f6f">REG_COLUMN_START</a>].min_val) {
<a name="l00113"></a>00113                 error_msg = <span class="stringliteral">"The start_x variable value (%u) is smaller than the minimal legal value: %u"</span>, nStart_x , <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#68f230679792e1a9d62495b02b261f6f">REG_COLUMN_START</a>].<a class="code" href="structlcv__reg__config.html#4c017d032e2797c0600a319e7c9d1a6d">min_val</a>;         
<a name="l00114"></a>00114                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00115"></a>00115                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00116"></a>00116                 exit(-1); 
<a name="l00117"></a>00117         }
<a name="l00118"></a>00118         <span class="keywordflow">if</span> (nStart_x &gt; <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#68f230679792e1a9d62495b02b261f6f">REG_COLUMN_START</a>].max_val) {
<a name="l00119"></a>00119                 error_msg = <span class="stringliteral">"The start_x variable value (%u) is bigger than the maximal legal value: %u"</span>, nStart_x , <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#68f230679792e1a9d62495b02b261f6f">REG_COLUMN_START</a>].<a class="code" href="structlcv__reg__config.html#2ae56857be882cf623effa62cfa141e8">max_val</a>;          
<a name="l00120"></a>00120                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00121"></a>00121                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00122"></a>00122                 exit(-1); 
<a name="l00123"></a>00123         }
<a name="l00124"></a>00124         
<a name="l00125"></a>00125         <span class="keywordflow">if</span> (nStart_y &lt; <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#9118c7f103fcc09a2104cd6efca36394">REG_ROW_START</a>].min_val) {
<a name="l00126"></a>00126                 error_msg = <span class="stringliteral">"The start_y variable value (%u) is smaller than the minimal legal value: %u"</span>, nStart_y , <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#9118c7f103fcc09a2104cd6efca36394">REG_ROW_START</a>].<a class="code" href="structlcv__reg__config.html#4c017d032e2797c0600a319e7c9d1a6d">min_val</a>;            
<a name="l00127"></a>00127                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00128"></a>00128                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00129"></a>00129                 exit(-1); 
<a name="l00130"></a>00130         }
<a name="l00131"></a>00131         <span class="keywordflow">if</span> (nStart_y &gt; <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#9118c7f103fcc09a2104cd6efca36394">REG_ROW_START</a>].max_val) {
<a name="l00132"></a>00132                 error_msg = <span class="stringliteral">"The start_y variable value (%u) is bigger than the maximal legal value: %u"</span>, nStart_y , <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#9118c7f103fcc09a2104cd6efca36394">REG_ROW_START</a>].<a class="code" href="structlcv__reg__config.html#2ae56857be882cf623effa62cfa141e8">max_val</a>;             
<a name="l00133"></a>00133                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00134"></a>00134                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00135"></a>00135                 exit(-1); 
<a name="l00136"></a>00136 
<a name="l00137"></a>00137         }
<a name="l00138"></a>00138         
<a name="l00139"></a>00139         <span class="keywordflow">if</span> (height != res_pic.<a class="code" href="structlcv__picture.html#d1fedb162e9fe3b19a1a70c24009a468">height</a>) {
<a name="l00140"></a>00140                 error_msg = <span class="stringliteral">"The captured picture does not have the same height as it is defined in the parameter"</span>;
<a name="l00141"></a>00141                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00142"></a>00142                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00143"></a>00143                 exit(-1);
<a name="l00144"></a>00144         }       
<a name="l00145"></a>00145         <span class="keywordflow">if</span> (width != res_pic.<a class="code" href="structlcv__picture.html#e83ac2254761aa2c6678f140565ddf52">width</a>) {
<a name="l00146"></a>00146                 error_msg = <span class="stringliteral">"The captured picture does not have the same height as it is defined in the parameter"</span>;
<a name="l00147"></a>00147                 printf(<span class="stringliteral">"%s %s:\nError: %s\n"</span>, <span class="stringliteral">"In Function"</span>, __FUNCTION__, error_msg);
<a name="l00148"></a>00148                 <a class="code" href="log_8c.html#ff9ff7830b2121dcd8e64d7cc1252534" title="Schreibt einen Fehler-Eintrag in die Protokolldatei.">lcv_log_error</a>(error_msg, __FUNCTION__);
<a name="l00149"></a>00149                 exit(-1);
<a name="l00150"></a>00150         }
<a name="l00151"></a>00151         
<a name="l00152"></a>00152         <span class="keywordflow">return</span> res_pic;
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154 
<a name="l00155"></a>00155 
<a name="l00156"></a><a class="code" href="cam_8h.html#075f93aa7cc073b84b2f80d2818ee86c">00156</a> <span class="keywordtype">char</span> <a class="code" href="cam-linux32_8c.html#7ad8b70964b854eb97169bd1469ba161" title="Schreibt eine Registerkonfiguration.">lcv_config_write</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> setting, <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> value)
<a name="l00157"></a>00157 {
<a name="l00158"></a>00158         <a class="code" href="cam-linux32_8c.html#b53dce123c908d50845fcdc89556eff9" title="Kamera Register initialisieren.">lcv_cam_reg_init</a>();
<a name="l00159"></a>00159         <span class="keywordtype">char</span> warning_msg[256];
<a name="l00160"></a>00160         
<a name="l00161"></a>00161         <span class="keywordflow">if</span> (0 &lt;= setting &amp;&amp; setting &lt; <a class="code" href="cam-reg-config_8h.html#6d1e10289ab90019ecc1e6d073dfc6ad" title="Anzahl Kameraregister.">cam_registers_cnt</a>) {
<a name="l00162"></a>00162                 <a class="code" href="structlcv__reg__config.html" title="Konfigurationsstruktur für LCV-Register.">lcv_reg_config</a> config = <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[setting];
<a name="l00163"></a>00163                 
<a name="l00164"></a>00164                 <span class="keywordflow">if</span> (config.<a class="code" href="structlcv__reg__config.html#4c017d032e2797c0600a319e7c9d1a6d">min_val</a> &lt;= value &amp;&amp; value &lt;= config.<a class="code" href="structlcv__reg__config.html#2ae56857be882cf623effa62cfa141e8">max_val</a>) {
<a name="l00165"></a>00165                         <a class="code" href="cam-linux32_8c.html#4fe1d355ae193dd2b61e97fcea0f32d4" title="Array mit Kameraregistern.">cam_reg_values</a>[setting] = value;
<a name="l00166"></a>00166                         <span class="keywordtype">char</span> log_entry[256];
<a name="l00167"></a>00167                         sprintf (log_entry, <span class="stringliteral">"Camera register Number %u was written to %u"</span>, config.<a class="code" href="structlcv__reg__config.html#0e8660865899c646b6849748b466affd">addr</a>, value);                 
<a name="l00168"></a>00168                         <a class="code" href="log_8c.html#64e28a98e670fc7cd88d040fe59c2f5d" title="Schreibt einen Eintrag in die Protokolldatei.">lcv_log</a>(log_entry);
<a name="l00169"></a>00169                         
<a name="l00170"></a>00170                         <span class="keywordflow">return</span> <a class="code" href="lcv-config_8h.html#a8cecfc5c5c054d2875c03e77b7be15d" title="Booleans.">TRUE</a>;
<a name="l00171"></a>00171                 } <span class="keywordflow">else</span> {
<a name="l00172"></a>00172                         sprintf(warning_msg,<span class="stringliteral">"Camera Register Number %u could not be written due to an illegal value: %u"</span>, config.<a class="code" href="structlcv__reg__config.html#0e8660865899c646b6849748b466affd">addr</a>, value);
<a name="l00173"></a>00173                         <a class="code" href="log_8c.html#8478a914926d15bf375feb130ff51b3e" title="Schreibt einen Warnungs-Eintrag in die Protokoll-Datei.">lcv_log_warning</a>(warning_msg, __FUNCTION__);
<a name="l00174"></a>00174                         <span class="keywordflow">return</span> <a class="code" href="lcv-config_8h.html#a8cbb6e43280c20eb5a8f0b2db94fcc7">ERROR_ILLEGAL_VALUE</a>;
<a name="l00175"></a>00175                 }
<a name="l00176"></a>00176         } <span class="keywordflow">else</span> {
<a name="l00177"></a>00177                 sprintf(warning_msg,<span class="stringliteral">"Camera Register Number %u doesn't exist"</span>, setting);
<a name="l00178"></a>00178                 <a class="code" href="log_8c.html#8478a914926d15bf375feb130ff51b3e" title="Schreibt einen Warnungs-Eintrag in die Protokoll-Datei.">lcv_log_warning</a>(warning_msg, __FUNCTION__);
<a name="l00179"></a>00179                 <span class="keywordflow">return</span> <a class="code" href="lcv-config_8h.html#1d3e305e508cdec9387e8660d0c3e67e">ERROR_ILLEGAL_SETTING</a>;
<a name="l00180"></a>00180         }       
<a name="l00181"></a>00181 }
<a name="l00182"></a>00182 
<a name="l00183"></a><a class="code" href="cam_8h.html#672e3188bbcf535ff2e06d8539a9c13d">00183</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> <a class="code" href="cam-linux32_8c.html#87fa1748b8561b93887e94d6a1e46dfa" title="Liest den Wert einer Registerkonfiguration.">lcv_config_read</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> setting)
<a name="l00184"></a>00184 {
<a name="l00185"></a>00185         <a class="code" href="cam-linux32_8c.html#b53dce123c908d50845fcdc89556eff9" title="Kamera Register initialisieren.">lcv_cam_reg_init</a>();
<a name="l00186"></a>00186         <span class="keywordtype">char</span> error_msg[256];
<a name="l00187"></a>00187         
<a name="l00188"></a>00188         <span class="keywordflow">if</span> (0 &lt;= setting &amp;&amp; setting &lt; <a class="code" href="cam-reg-config_8h.html#6d1e10289ab90019ecc1e6d073dfc6ad" title="Anzahl Kameraregister.">cam_registers_cnt</a>) {
<a name="l00189"></a>00189                 <span class="keywordflow">return</span> <a class="code" href="cam-linux32_8c.html#4fe1d355ae193dd2b61e97fcea0f32d4" title="Array mit Kameraregistern.">cam_reg_values</a>[setting];
<a name="l00190"></a>00190         } <span class="keywordflow">else</span> {
<a name="l00191"></a>00191                 sprintf(error_msg, <span class="stringliteral">"Camera Register Number %u does not exist"</span>, setting);
<a name="l00192"></a>00192                 <span class="comment">//printf("%s %s:\nWarning: %s\n", "In Function", __FUNCTION__, error_msg);</span>
<a name="l00193"></a>00193                 <a class="code" href="log_8c.html#8478a914926d15bf375feb130ff51b3e" title="Schreibt einen Warnungs-Eintrag in die Protokoll-Datei.">lcv_log_warning</a>(error_msg, __FUNCTION__);
<a name="l00194"></a>00194                 <span class="keywordflow">return</span> 0;
<a name="l00195"></a>00195         }
<a name="l00196"></a>00196 }
<a name="l00197"></a>00197 
<a name="l00198"></a><a class="code" href="cam_8h.html#280d093e6ddc853845445c45449fff6c">00198</a> <span class="keywordtype">char</span> <a class="code" href="cam-linux32_8c.html#280d093e6ddc853845445c45449fff6c" title="Setzt alleRegister auf ihren Standardwert.">lcv_regs_to_default</a>()
<a name="l00199"></a>00199 {
<a name="l00200"></a>00200         <span class="keywordtype">int</span> i;
<a name="l00201"></a>00201         <span class="keywordflow">for</span> (i=0; i&lt;<a class="code" href="cam-reg-config_8h.html#6d1e10289ab90019ecc1e6d073dfc6ad" title="Anzahl Kameraregister.">cam_registers_cnt</a>; i++) {
<a name="l00202"></a>00202                 <a class="code" href="cam-linux32_8c.html#7ad8b70964b854eb97169bd1469ba161" title="Schreibt eine Registerkonfiguration.">lcv_config_write</a>(i, <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[i].default_val);
<a name="l00203"></a>00203         }
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 
<a name="l00206"></a><a class="code" href="cam_8h.html#07a0b332c7bbc5d99dabef97da819574">00206</a> <span class="keywordtype">void</span> <a class="code" href="cam-linux32_8c.html#07a0b332c7bbc5d99dabef97da819574" title="Setzt die 4 für die Bildregion verantwortlichen Register auf den Standardwert zurück...">lcv_reset_capture_frame</a>()
<a name="l00207"></a>00207 {
<a name="l00208"></a>00208         <a class="code" href="cam-linux32_8c.html#7ad8b70964b854eb97169bd1469ba161" title="Schreibt eine Registerkonfiguration.">lcv_config_write</a>(<a class="code" href="cam-config_8h.html#68f230679792e1a9d62495b02b261f6f">REG_COLUMN_START</a>, <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#68f230679792e1a9d62495b02b261f6f">REG_COLUMN_START</a>].default_val);
<a name="l00209"></a>00209         <a class="code" href="cam-linux32_8c.html#7ad8b70964b854eb97169bd1469ba161" title="Schreibt eine Registerkonfiguration.">lcv_config_write</a>(<a class="code" href="cam-config_8h.html#9118c7f103fcc09a2104cd6efca36394">REG_ROW_START</a>, <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#9118c7f103fcc09a2104cd6efca36394">REG_ROW_START</a>].default_val);
<a name="l00210"></a>00210         <a class="code" href="cam-linux32_8c.html#7ad8b70964b854eb97169bd1469ba161" title="Schreibt eine Registerkonfiguration.">lcv_config_write</a>(<a class="code" href="cam-config_8h.html#0e03dbfdd5f8c2ea81d0ee40c7c3e1fb">REG_WINDOW_WIDTH</a>, <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#0e03dbfdd5f8c2ea81d0ee40c7c3e1fb">REG_WINDOW_WIDTH</a>].default_val);
<a name="l00211"></a>00211         <a class="code" href="cam-linux32_8c.html#7ad8b70964b854eb97169bd1469ba161" title="Schreibt eine Registerkonfiguration.">lcv_config_write</a>(<a class="code" href="cam-config_8h.html#46a42d02832af075fb639880da5e53ee">REG_WINDOW_HEIGHT</a>, <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[<a class="code" href="cam-config_8h.html#46a42d02832af075fb639880da5e53ee">REG_WINDOW_HEIGHT</a>].default_val);     
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213 
<a name="l00214"></a><a class="code" href="cam-linux32_8c.html#b53dce123c908d50845fcdc89556eff9">00214</a> <span class="keywordtype">void</span> <a class="code" href="cam-linux32_8c.html#b53dce123c908d50845fcdc89556eff9" title="Kamera Register initialisieren.">lcv_cam_reg_init</a>()
<a name="l00215"></a>00215 {
<a name="l00216"></a>00216         <span class="keywordtype">int</span> i;
<a name="l00217"></a>00217         
<a name="l00218"></a>00218         <span class="keywordflow">if</span> (!<a class="code" href="cam-linux32_8c.html#8049d634362b9eb19890caed04aeb40b" title="Kamera Register inizialisiert.">cam_reg_initialized</a>) {
<a name="l00219"></a>00219                 <span class="keywordflow">for</span> (i=0; i&lt;<a class="code" href="cam-reg-config_8h.html#6d1e10289ab90019ecc1e6d073dfc6ad" title="Anzahl Kameraregister.">cam_registers_cnt</a>; i++) {
<a name="l00220"></a>00220                         <a class="code" href="cam-linux32_8c.html#4fe1d355ae193dd2b61e97fcea0f32d4" title="Array mit Kameraregistern.">cam_reg_values</a>[i] = <a class="code" href="cam-reg-config_8h.html#29a2d67ac8fcb996d490c3dfa151b710" title="Die Registerkonfigurationen Die Werte wurden aus dem Datenblatt des CMOS Sensors...">cam_reg_config</a>[i].<a class="code" href="structlcv__reg__config.html#9153f7e40c3664948600e62856c20bbf">default_val</a>;
<a name="l00221"></a>00221                 }
<a name="l00222"></a>00222                 <a class="code" href="cam-linux32_8c.html#8049d634362b9eb19890caed04aeb40b" title="Kamera Register inizialisiert.">cam_reg_initialized</a> = <a class="code" href="lcv-config_8h.html#a8cecfc5c5c054d2875c03e77b7be15d" title="Booleans.">TRUE</a>;
<a name="l00223"></a>00223         }
<a name="l00224"></a>00224 }
<a name="l00225"></a>00225 
<a name="l00226"></a><a class="code" href="cam_8h.html#f73241718d1a517f6e12e4ee474b5c30">00226</a> <span class="keywordtype">void</span> <a class="code" href="cam-linux32_8c.html#f73241718d1a517f6e12e4ee474b5c30" title="Aktiviert bzw.">lcv_reg_buffering</a>(<span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> enable) {
<a name="l00227"></a>00227         <span class="comment">//leer  </span>
<a name="l00228"></a>00228 }
</pre></div><hr size="1"><address style="text-align: right;"><small>Erzeugt am Wed Dec 19 16:38:17 2007 für LCV Framework von&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
</body>
</html>
